package com.shlh.saas.mapper.canton.buyer;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shlh.saas.entity.canton.buyer.CantonFairBuyer127;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 第127届广交会采购商数据访问接口
 */
@Mapper
public interface CantonFairBuyer127Mapper extends BaseMapper<CantonFairBuyer127> {
    
    /**
     * 使用自定义 SQL 查询，避免 MyBatis 自动生成包含不存在字段的 SQL
     */
    @Select("SELECT id, company_name, country, contact_person, telephone, fax, contact_address, email, demand_goods, website FROM canton_fair_buyers_127 ${ew.customSqlSegment}")
    List<CantonFairBuyer127> selectListWithCustomSql(@Param("ew") LambdaQueryWrapper<CantonFairBuyer127> wrapper);
    
    /**
     * 使用自定义 SQL 查询分页数据，避免 MyBatis 自动生成包含不存在字段的 SQL
     */
    @Select("SELECT id, company_name, country, contact_person, telephone, fax, contact_address, email, demand_goods, website FROM canton_fair_buyers_127 ${ew.customSqlSegment}")
    Page<CantonFairBuyer127> selectPageWithCustomSql(Page<CantonFairBuyer127> page, @Param("ew") LambdaQueryWrapper<CantonFairBuyer127> wrapper);

    /**
     * 使用自定义 SQL 查询计数，避免 MyBatis 自动生成包含不存在字段的 SQL
     */
    @Select("SELECT COUNT(*) FROM canton_fair_buyers_127 ${ew.customSqlSegment}")
    Long selectCountWithCustomSql(@Param("ew") LambdaQueryWrapper<CantonFairBuyer127> wrapper);
} 